home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C ++ / Applications / TimGA 1.2.1 / .h / CGraphPane.h < prev    next >
Encoding:
Text File  |  1997-07-16  |  1.8 KB  |  77 lines  |  [TEXT/CWIE]

  1. // ===========================================================================
  2. //    CGraphPane.h        ©1995-97 Timo Eloranta        All rights reserved.
  3. // ===========================================================================
  4. //    This class displays the best drawing on the screen.
  5.  
  6. #pragma once
  7.  
  8. #include <LView.h>
  9. #include <LCommander.h>
  10. #include <URegistrar.h>
  11. #include "CGraphDrawing.h"
  12.  
  13. class    LGWorld;
  14. class    CGraphGAApp;
  15.  
  16. class    CGraphPane :    public LView,
  17.                         public LCommander {
  18. private:
  19.     CGraphGAApp            *mApp;
  20.     CGraphPtr            mGraph;
  21.     LGWorld                *mGWorld;
  22.     Int16                mGridSquareSize;
  23.     Int16                mMaxSquareSize;
  24.     Int16                mNodeSize;
  25.     Rect                mGridRect;
  26.     Rect                mFrameRect;
  27.     SDimension16        mWindStdSize;
  28.     
  29.     Boolean                mFullWindow,
  30.                         mShowGrid,
  31.                         mShowEdges,
  32.                         mShowNodes,
  33.                         mDarkGrid,
  34.                         mUseColor,
  35.                         mDrawingIsOld;
  36.                         
  37.                         // --- Private methods ---
  38.     
  39.     void                CalculateGridRect();
  40.                                                     
  41.     void                EraseBackground(    Rect &inEraseRect, 
  42.                                             Boolean inForceErase );
  43.     void                PlaceInClipboard();
  44.     PicHandle            CreatePict();
  45.     void                DrawTheBest();
  46.     void                DrawGrid();
  47.     void                DrawEdges( Boolean inDrawToPict = false );
  48.     void                DrawNodes();
  49.     
  50.     Int16                SelectNodeSize();
  51.     Int16                GetNextSquareSize( Boolean inBigger );
  52.     Boolean                ValidSquareSize( Int16 inSize );
  53.  
  54. protected:
  55.     virtual void        DrawSelf();
  56.  
  57. public:
  58.     enum { 
  59.         class_ID = 'GrPa' 
  60.     };
  61.  
  62.                         CGraphPane( LStream *inStream );
  63.     virtual                ~CGraphPane();
  64.     
  65.     virtual Boolean        ObeyCommand( CommandT inCommand, void *ioParam );
  66.     virtual void        FindCommandStatus( CommandT inCommand,
  67.                                 Boolean &outEnabled, Boolean &outUsesMark,
  68.                                 Char16 &outMark, Str255 outName);
  69.  
  70.     void                SetGraph( CGraphPtr inGraph );
  71.     void                SetApp( CGraphGAApp * inApp)
  72.                         {    mApp = inApp;    };
  73.     
  74.     void                InvalidateDrawing( Boolean inDrawNow );
  75.  
  76. };
  77.